package org.hong.monkey.ui.jobs

import org.hong.monkey.scheduler.SchedulingMode
import org.hong.monkey.ui.{MonkeyUI, MonkeyUITab}

/** Web UI showing progress status of all jobs in the given MonkeyContext. */
private[ui] class JobsTab(parent: MonkeyUI) extends MonkeyUITab(parent, "jobs") {
  val sc = parent.sc
  val killEnabled = parent.killEnabled
  val jobProgresslistener = parent.jobProgressListener
  val executorListener = parent.executorsListener
  val operationGraphListener = parent.operationGraphListener

  def isFairScheduler: Boolean =
    jobProgresslistener.schedulingMode.exists(_ == SchedulingMode.FAIR)

  attachPage(new AllJobsPage(this))
  attachPage(new JobPage(this))
}
